import request from '@/utils/request';
import type {
  ResourcePageDTO,
  ResourceSaveDTO,
  ResourceUpdDTO,
  Page,
  Resource,
  BaseResponse
} from '@/types';

// 资源分页查询
export const getResourcePage = (data :ResourcePageDTO) => {
  return request.post<BaseResponse<Page<Resource>>>('/resource/page', data);
};

// 保存资源
export const saveResource = (data :ResourceSaveDTO) => {
  return request.post<BaseResponse<boolean>>('/resource/save', data);
};

// 更新资源
export const updateResource = (data :ResourceUpdDTO) => {
  return request.post<BaseResponse<void>>('/resource/update', data);
};

// 删除资源
export const deleteResource = (data :{ id :number }) => {
  return request.post<BaseResponse<void>>('/resource/delete', data);
};
